Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(astro): Fixes prerender conflicts of lower-priority routes #11694

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Fryuni
Copy link
Member

@Fryuni Fryuni commented Aug 14, 2024

Changes

  • Fixes Adapters not following the route priority ordering after build #11266
  • The routes are sorted by priority and built, but the adapters serve all pre-rendered pages in front of the applications.
  • Prerendered routes that would conflict with a higher priority SSR route are now skipped, just as they are for other higher-priority pre-rendered routes.
  • The dev server was already following the route priority order since it matches based on the route list. Only prod builds incorrectly placed lower-priority routes in front of higher-priority routes.

Testing

A new lower-priority route (with a rest parameter) was added to the ssr-prerender test suite that conflicts with the pre-rendered /static route and the SSR /not-prerendered route. The new route must be skipped in both cases, resulting in:

  • A prerendered /static path with the contents of the /static route
  • No /not-prerendered being prerendered

Docs

The new behavior matches what is already documented.

@Fryuni Fryuni added the feat: routing Related to Astro routing (scope) label Aug 14, 2024
@Fryuni Fryuni self-assigned this Aug 14, 2024
Copy link

changeset-bot bot commented Aug 14, 2024

🦋 Changeset detected

Latest commit: 23767b5

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Aug 14, 2024
@Fryuni
Copy link
Member Author

Fryuni commented Aug 14, 2024

Whoops, I didn't consider the fallback routes. Back to the board

@ematipico
Copy link
Member

Whoops, I didn't consider the fallback routes. Back to the board

Fallback routes should be really simple to handle. However, maybe we should refactor them.

At the moment they contain copies of what we already have inside RouteData[]. Maybe we should, instead, just save the index of those routes.

@ematipico
Copy link
Member

@Fryuni any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: routing Related to Astro routing (scope) pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adapters not following the route priority ordering after build
2 participants